import request from '@/utils/request.js';
import { setting } from '@/config/setting';
import qs from "qs";
const { tokenName } = setting;
export const login = async (data) => {
  data['scope'] = 'ui'
  data['grant_type'] = 'password'
  data['type'] = 'account'
  return request({
    url: '/oauth/token',
    method: 'post',
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
    data,
  });
};

export const getUserInfo = (accessToken) => {
  return request({
    url: '/adminUser/userInfo',
    method: 'get',
  });
};

export const RegisterSubmit = (form) => {
  return request({
    url: '/adminUser/register',
    method: 'post',
    // headers: { 'Content-Type': 'application/json;charset=utf-8' },
    data: form
  });
};

export const logout = () => {
  return request({
    url: '/logout',
    method: 'post',
  });
};

//根据用户名获取用户信息
export const getUserByName = (form) => {
  return request({
    url: '/user/getByName',
    method: 'post',
    data: form
  });
};


//获取用户下拉
export const userSelect = () => {
  return request({
    url: '/user/userSelect',
    method: 'post'
  });
};




// export const register = async () => {
//   return request({
//     url: '/register',
//     method: 'post',
//   });
// };
